Estimate Human Pose For Multiple Person Using Pretrained Network
Load pretrained pose estimator model
detector = posenet.PoseEstimator;
Make a prediction for multi-person
Next, we will try to estimate keypoints with a test image. First, read a test image.
I = imread('visionteam1.jpg');
Detect people in the loaded image.
[bboxes,scores] = detectPeopleACF(I);
Iout = insertObjectAnnotation(I,'rectangle',bboxes,scores,'LineWidth',3);
title('Detected people and detection scores')
Extract and transform the detected objects to fit the input of the network.
[croppedImages, croppedBBoxes] = detector.normalizeBBoxes(I, bboxes);
Iout2 = insertObjectAnnotation(I,'rectangle',croppedBBoxes,scores,'LineWidth',3);
title('Resize the bounding boxes to be the same aspect ratio in the input of the network.');
figure, montage(croppedImages);
title('Each cropped image')
Estimate keypoints for each cropped image
heatmaps = detector.predict(croppedImages);
Iheatmaps = detector.visualizeHeatmaps(heatmaps, croppedImages);
keypoints = detector.heatmaps2Keypoints(heatmaps);
Iheatmaps = detector.visualizeKeyPoints(Iheatmaps,keypoints);
title('Extracted joints for each person');
Iout3 = detector.visualizeKeyPointsMultiple(I,keypoints,croppedBBoxes);
title('Estimated keypoints in the coordinates of the original image');
Copyright 2020 The MathWorks, Inc.